/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("Mds_LogisticType",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using DGZImp.MdsProject.DomainModels;
using DGZImp.MdsProject.IServices;
using DGZImp.Core.Utilities.Response;
using DGZImp.MdsProject.Models;

namespace DGZImp.MdsProject.Controllers
{
    public partial class Mds_LogisticTypeController
    {
        private readonly IMds_LogisticTypeService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public Mds_LogisticTypeController(
            IMds_LogisticTypeService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }

        public override ApiResponse<object> GetDetailPage(PageDataOptions pageData)
        {
            pageData.Order = "Asc";
            pageData.Sort = "Seq";
            return base.GetDetailPage(pageData);
        }

        public override ApiResponse<object> GetPageData(PageDataOptions options)
        {
            var res = base.GetPageData(options);
            var data = (PageGridData<Mds_LogisticType>)res.Data;
            foreach (var item in data.rows)
            {
                item.LogisticTypeEnumTxt = ((LogisticTaskTypeEnum)item.LogisticType).ToString();
            }
            return res;
        }
    }
}
